#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

#define   N   16
typedef  struct
{
	char  num[10];
	int   s;
} STREC;
int  fun(STREC* a, STREC* b)
{
	for (int i = 0;i < N; i++)
	{
		for (int j = 0; j < N - i; j++)
		{
			if (a[j].s < a[j+1].s)
			{
				int num = a[j].s;
				a[j].s = a[j+1].s;
				a[j+1].s = num;
			}
		}
	}

	int S = 1;
	for (int k = 1; k < N; k++)
	{
		if (a[k].s == a[k-1].s)
		{
			S++;
		}
		else
		{
			break;
		}
	}


	return S;
}

int main()
{



	STREC  s[N] = { {"GA05",85},{"GA03",76},{"GA02",69},{"GA04",85},
	   {"GA01",91},{"GA07",72},{"GA08",64},{"GA06",87},
	   {"GA015",85},{"GA013",91},{"GA012",64},{"GA014",91},
	   {"GA011",77},{"GA017",64},{"GA018",64},{"GA016",72} };
	STREC  h[N];
	int  i, n; FILE* out;
	n = fun(s, h);
	printf("The %d highest score :\n", n);

	for (int i = 0; i < N; i++)
	{
       printf("%d ", s[i].s);
	}
	printf("\n");

	for (i = 0; i < n; i++)
		printf("%s  %4d\n", h[i].num, h[i].s);

	printf("\n");
	out = fopen("out.dat", "w");
	fprintf(out, "%d\n", n);
	for (i = 0; i < n; i++)
		fprintf(out, "%4d\n", h[i].s);
	fclose(out);
}
